package kjd;

import static org.junit.Assert.assertTrue;
import kjd.test.RobotTestBed;
import robocode.BattleResults;
import robocode.control.events.BattleCompletedEvent;

/**
 * Illustrates JUnit testing of Robocode robots. This tests that GunAryos will Ram opponents in
 * situations. Based on file provided by Philip Johnson. Modified for GunAryos and kjd package.
 * 
 * @author Philip Johnson, Kendyll Doi
 * 
 */
public class TestGunAryosRamsClose extends RobotTestBed {
  /**
   * Specifies that RamFire and GunAryos are to be matched up in this test case.
   * RamFire Chosen because of higher tendency for ramming instances.
   * 
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "sample.RamFire,kjd.GunAryos";
  }

  /**
   * This test runs for 10 rounds.
   * 
   * @return The number of rounds.
   */
  @Override
  public int getNumRounds() {
    return 10;
  }

  /**
   * The actual test, which asserts that GunAryos deals ram damage in a battle.
   * 
   * @param event Details about the ended turn.
   */
  @Override
  public void onBattleCompleted(BattleCompletedEvent event) {
    // Return the results in order of getRobotNames.
    BattleResults[] results = event.getIndexedResults();
    // Checks that GunAryos dealt RamDamage as part of battle strategy.
    assertTrue("GunAryos Ram Results has points.", results[1].getRamDamage() > 0);
  }
}
